package com.pomr.model.sys;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import javax.persistence.*;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.hibernate.annotations.GenericGenerator;
/**
 * 角色表
 * @author Administrator
 *
 */
@Entity
@Table(name="role")
public class Role implements Serializable{
//	public Set<Effect> getEffects() {
//		return effects;
//	}
//	public void setEffects(Set<Effect> effects) {
//		this.effects = effects;
//	}
	public Integer getType() {
		return type;
	}
	public void setType(Integer type) {
		this.type = type;
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getRoleName() {
		return roleName;
	}
	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public Set<RoleEffect> getRoleEffects() {
		return roleEffects;
	}

	public void setRoleEffects(Set<RoleEffect> roleEffects) {
		this.roleEffects = roleEffects;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO, generator = "native")
    @GenericGenerator(name = "native", strategy = "native")//AUTO 在mysql中需要指定使用本地策略生成主键值
    @Column(name = "id", updatable = false, nullable = false)
	private int id;//角色编号
	@Column(name="role_name",length=50,nullable=false)
	private String roleName;//角色名
	@Column(name="type",length=10,columnDefinition="int default 3")
	private Integer type;// 角色等级 1超级管理员权限
	@Column(name="status")
	private Integer status;// 角色状态 -1 失效
	@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
	@Column(name="create_time")
	private Date createTime;//创建日期
	@Column(name="remark",length = 255)
	private String remark;//备注
	@Transient
	private Set<RoleEffect> roleEffects;//角色权限信息
}
